package codeTop;

/**
 * lcr161
 *
 * @author 雨凡
 * @version lcr161.java, v0.1
 * @date 2025/07/04/22:31
 */
public class lcr161 {
    public int maxSales(int[] sales) {
        int max = Integer.MIN_VALUE;
        int pre = 0;
        for (int i = 0; i < sales.length; i++) {
            if (pre >= 0) {
                pre += sales[i];
            }else {
                pre = sales[i];
            }
            max = Math.max(pre,max);
        }
        return max;
    }
}
